<%-------------------------------------------------------------------
 * 页面名称：main.jsp
 * 功能描述：登录页面
 * Action:  logon.do
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="struts-html.tld" prefix="html"%>
<%@ taglib uri="struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="struts-logic.tld" prefix="logic"%>
<%@ taglib uri="struts-bean.tld" prefix="bean"%>

<%
	String path = request.getContextPath();
	String email = (String) request.getSession().getAttribute("email");
	if (email == null) {
		email = "";
	} else {
		request.getSession().removeAttribute("email");
	}
	String operator = (String) request.getSession().getAttribute(
			"operator");
	if (operator == null) {
		operator = "";
	} else {
		request.getSession().removeAttribute("operator");
	}
	boolean net = request.getSession()
			.getAttribute("netReturnResponse") == null;
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type"
			content="text/html; charset=charset=utf-8">
	    <script language="javascript" src="<%=path%>/js/jquery-1.4.3.min.js"></script>
		<link href="<%=path%>/css/newstyle.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/css/common.css" rel="stylesheet" type="text/css" />
		<script type='text/javascript' src='<%=path%>/dwr/engine.js'></script>
		<script type="text/javascript"
			src="<%=path%>/js/vnv/commonForMutual.js"></script>
		<script type="text/javascript" src="<%=path%>/js/pagetitle.js"></script>
		<script type="text/javascript"
			src="<%=path%>/js/PassGuardCtrl.js"></script>
	    <script type='text/javascript' src='<%=path%>/js/demo.js'></script>
	    <script src="<%=path%>/js/global.js"></script> 
		<style type="text/css">
<!--
.yanzheng {font-size: 12px}
-->
</style>

		<SCRIPT LANGUAGE="JavaScript">
<!--
	// 切换tab显示
	function switchTab(id_num,num){
		for(var i=1;i<=2;i++) { 
			if(id_num==i) { 
				getObj('Tab_'+i).className='login_person'; 
				getObj('login'+i).style.display='';
			} 
			else { 
				getObj('Tab_'+i).className='login_company'; 
				getObj('login'+i).style.display='none'; 
				
			} 
		}
		// 刷新校验码
		refreshVericode('logon_sys_vericode_image'+num);
		getObj('logon_person_email').value='EMAIL/手机号码';
		getObj('logon_person_passPerson').value='登录密码';
		getObj('logon_person_sys_vericode').value='';
		getObj('logon_corp_email').value='EMAIL';
		getObj('logon_corp_operator').value='操作员';
		//getObj('logon_corp_passCorp').value='登录密码';
		getObj('logon_corp_sys_vericode').value='';
		
		// 获得焦点
		//if(num == 0) {
			//getObj('logon_person_email').focus();
		//}
		//if(num == 1) {
		//	getObj('logon_corp_email').focus();
		//}
	}
	// 刷新校验码
	function refreshVericode(imgObjName) {
		var now = new Date();
		getObj(imgObjName).src = '<%=path%>/page/util/verifyImage.jsp?now='+now.getTime().toString();
	}

	function logon(type) {
		//获取随机因子
		SubmitForm();
	
		document.getElementById("logon_atype").value = type;
		
		if(type == "A") { //个人
			//加密后密码
		    var PwdResult=pgeditor.pwdResult();
		
			getObj('logon_person_passPerson').value=PwdResult;
			
			if(emptyValidate(getObj("logon_person_email"),"Email或手机") != "") {
				getObj("logon_person_email").focus();
				return false;
			}
			
			if(pgeditor.pwdLength()==0){
			     alert("密码不能为空");
				 _$("_ocx_password").focus();
				 return false;
			}
				
			if(emptyValidate(getObj("logon_person_sys_vericode"),"校验码") != "") {
				getObj("logon_person_sys_vericode").focus();
				return false;
			}				
		} else if(type == "B") { //企业
			//加密后密码
		    var PwdResult1=pgeditor1.pwdResult();
		    
			getObj('logon_corp_passCorp').value=PwdResult1;
			
			if(emptyValidate(getObj("logon_corp_email"),"Email") != "") {
				getObj("logon_corp_email").focus();
				return false;
			}
			
			if(emptyValidate(getObj("logon_corp_operator"),"操作员") != "") {
				getObj("logon_corp_operator").focus();
				return false;
			}
			if(pgeditor1.pwdLength()==0){
			     alert("密码不能为空");
				 _$("_ocx_password1").focus();
				 return false;
			}	
			if(emptyValidate(getObj("logon_corp_sys_vericode"),"校验码") != "") {
				getObj("logon_corp_sys_vericode").focus();
				return false;
			}		
		}
				
		document.getElementById("url").value=location.href;
		
		document.frmLogon.submit();
	}
	
	function pers() {
		if(event.keyCode==13){
			logon('A');
		}
	}
	function corp() {
		if(event.keyCode==13){
			logon('B');
		}
	}
	function cleanpersonemail()
	{
		getObj('logon_person_email').value='';
		
	}
	
	function cleanpersonpassPerson()
	{
		getObj('logon_person_passPerson').value='';
	}
	
	function cleancorpemail()
	{
		getObj('logon_corp_email').value='';
	}
	
	function cleancorpoperator()
	{
		getObj('logon_corp_operator').value='';
	}
	
	function cleancorppassCorp()
	{
		getObj('logon_corp_passCorp').value='';
	}
	
	window.onload = function(){	 
	   pgeditor.pgInitialize();//初始化控件
	   pgeditor1.pgInitialize();//初始化控件
	}
//-->
</SCRIPT>
	</head>

	<%
	if (net) {
	%>
	<body style="margin:0" class="loginhtml">
		<%
		} else {
		%>
	
	<body onload="switchTab('2',1);" style="margin:0" class="loginhtml">
		<%
		}
		%>
		<div class="login_head1">
			<div style="margin-left:30px;font-size: 20px;">
				<script>document.write(content.name);</script>首页
			</div>
			<div style="margin-left:700px;">
				反馈&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;帮助
			</div>
		</div>
		<!-- <div class="login_head2"></div> -->
		<!--  <div class="login_logo">
			<img src="<%=path %>/images/LOGO-4_a.jpg" />
		</div>-->
		<form name="frmLogon" action="<%=path %>/logon.do" method="post">
			<input type="hidden" id="logon_atype" name="logon_atype" />
			<div class="login_login" id="login1">
				<div class="login_choose">
					<div class="login_person" id="Tab_1" onclick="switchTab('1',0);">
						个人登录
					</div>
					<div class="login_company" id="Tab_2" onclick="switchTab('2',1);">
						企业登录
					</div>
				</div>
				<div class="login_input" id="cont_1" onKeyDown="pers()">
					<div>
						<input name="logon_person_email" type="text" value="EMAIL/手机号码" tabindex="1"
							maxlength="100" onfocus="cleanpersonemail();" class="login_inputsytle"/>
						<input type="hidden" id="from" name="from"
							value="invalid_session_failure" />
						<input type="hidden" id="url" name="url" />
					</div>
					<div>
					<script type="text/javascript">pgeditor.generate()</script>
					
					
				   <input name="logon_person_passPerson" type="hidden" value="登录密码"
							onfocus="cleanpersonpassPerson();" class="login_inputsytle"
							maxlength="64" />
					</div>
					<div>
						<span class="yanzheng">验证码</span>:
						<input name="logon_person_sys_vericode" maxlength="4" tabindex="3"
							style="width:45px; height:27px;" type="text" size="4"
							onblur="killSpace(this);" utext="校验码"
							uregular="UValidate.notEmpty" />
						<img name="logon_sys_vericode_image0" width="70" height="27px;"
							src="<%=path%>/page/util/verifyImage.jsp" width="60" height="24"
							align="absmiddle" />
						<a href="#" title="看不清校验码请点击此图标刷新！"
							onclick="javascript:refreshVericode('logon_sys_vericode_image0');"><span
							class="lan yanzheng">换一张</span> </a>
					</div>
					<div>
						<table>
							<tr>
								<td width="138" rowspan="2">
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="button"
										style="background:url(<%=path %>/images/login_button.gif) no-repeat;width:112px;height:42px;border:0px;cursor:pointer;"
										onclick="logon('A')" />
								</td>
								<td width="80" height="16">
									<a href="<%=path %>/toRegister.do">注册账号</a>
								</td>
								<td width="85">
									<a href="<%=path %>/toForgot.do">忘记密码了</a>
								</td>
							</tr>
							<tr>
								<td>
									<a href="<%=path %>/toActimail.do">重发激活信</a>
								</td>
								<td>
									<a href="<%=path %>/toActivate.do">填写激活码</a>
								</td>
							</tr>
						</table>
					</div>
					<div
						style="color:#999999; background:#F2F2F2; border-bottom:4px solid #3398CB; height:58px; line-height:58px; margin:15px 7px 0 7px;">
						客服电话：<script>document.write(content.tel);</script>
					</div>
				</div>
			</div>
			<div class="login_login" id="login2" style="display:none;">
				<div class="login_choose">
					<div class="login_company" onclick="switchTab('1',0);">
						个人登录
					</div>
					<div class="login_person" onclick="switchTab('2',1);">
						企业登录
					</div>
				</div>
				<div class="login_input" id="cont_2" onKeyDown="corp()">
					<div>
						<input name="logon_corp_email" type="text" value="EMAIL/手机号码" tabindex="1" class="login_inputsytle"
							maxlength="100" onfocus="cleancorpemail();" />
						<input type="hidden" id="from" name="from"
							value="company_main_failure" />
						<input type="hidden" id="url" name="url" />
					</div>
					<div>
						<input name="logon_corp_operator" type="text" value="操作员" tabindex="2" class="login_inputsytle"
							onfocus="cleancorpoperator();" maxlength="64" />
					</div>
					<div>
					<script type="text/javascript">pgeditor1.generate()</script>
					
						<input name="logon_corp_passCorp" type="hidden" value="登录密码"
							onfocus="cleancorppassCorp();" />
					</div>
					<div>
						<span class="yanzheng">验证码</span>:
						<input name="logon_corp_sys_vericode" maxlength="4"
							style="width:45px; height:27px;" type="text" size="4"
							onblur="killSpace(this);" utext="校验码"
							uregular="UValidate.notEmpty" />
						<img name="logon_sys_vericode_image1" width="70" height="27px;"
							src="<%=path%>/page/util/verifyImage.jsp" width="60" height="24"
							align="absmiddle" />
						<a href="#" title="看不清校验码请点击此图标刷新！"
							onclick="javascript:refreshVericode('logon_sys_vericode_image1');"><span
							class="lan yanzheng">换一张</span> </a>
					</div>
					<div>
						<table>
							<tr>
								<td width="138" rowspan="2">
									&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
									<input type="button"
										style="background:url(<%=path %>/images/login_button.gif) no-repeat;width:112px;height:42px;border:0px;cursor:pointer;"
										onclick="logon('B')" />
								</td>
								<td width="80" height="16">
									<a href="<%=path %>/toCompanyRegister.do">注册账号</a>
								</td>
								<td width="85">
									<a href="<%=path %>/toForgot.do">忘记密码了</a>
								</td>
							</tr>
							<tr>
								<td>
									<a href="<%=path %>/toActimail.do">重发激活信</a>
								</td>
								<td>
									<a href="<%=path %>/toActivate.do">填写激活码</a>
								</td>
							</tr>
						</table>
					</div>
					<div style="color:#999999;">
						客服电话：<script>document.write(content.tel);</script>
					</div>
				</div>
			</div>
			<div class="login_foot">
				<div
					style="text-align:center;font-size:12px;color:#7D7D7D; line-height:20px;">
					<a href="#" target="_blank" style="color:#07679C">关于<script>document.write(content.name);</script></a>
					|
					<a href="#" target="_blank" style="color:#07679C">联系我们</a>
					|
					<a href="#" target="_blank" style="color:#07679C">新闻中心</a>
					|
					<span style="color:#FF6500">客服：<script>document.write(content.tel);</script></span>
				</div>
				<div
					style="text-align:center;font-size:12px;color:#7D7D7D; line-height:20px;">
					Copyright © 2014 <script>document.write(content.enname);</script> Holdings Limited, All Rights Reserved <br/>
					<script>document.write(content.company);</script>- 版权所有
				</div>
				<div style="text-align:center; padding:10px;">
					<img src="<%=path %>/images/bottomimg.gif" />
				</div>
			</div>
		</form>
		<%
			// 返回错误提示时保留输入的账号内容
			if (!operator.equals("")) {
		%>
		<script language="javascript">
		switchTab('2',1)
		getObj('logon_corp_email').value='<%=email%>';
		getObj('logon_corp_operator').value='<%=operator%>';
	</script>
		<%
		} else if (!email.equals("")) {
		%>
		<script language="javascript">
		getObj('logon_person_email').value='<%=email%>';
	</script>
		<%
		}
		%>
		<jsp:include page="/page/common/bankFramePage/message.jsp" />
	</body>
</html>
